<template>
    <view class="integral ph-32 pv-32">
        <Navigation backType="back" title="积分明细" background="#fff" />
        <view class="w-f h-188 b-8 top-bg f ai-c jc-c fd-c">
            <view class="f ai-c">
                <image src="http://cwht.ricecs.cn/app/mine/jf.png" class="w-32 h-32 mr-12"></image>
                <view class="fs-28 text-color2">萌宠支付积分</view>
            </view>
            <view class="mt-16 fs-49 fw-600 text-color4">{{userInfo.point}}</view>
        </view>
        <view class="f w-f ai-c jc-s-b ph-32 pv-32 mt-20 list b-24" v-for="(item, index) in list" :key="index">
            <view class="f f1 fd-c mr-20">
                <view class="fs-32 fw-600 text-color4">{{item.description}}</view>
                <view class="fs-24 text-color3 mt-16">{{item.createTime}}</view>
            </view>
            <view class="w-100 f fc-f-e fs-32 fw-600 " :class="item.point<0?'text-color4':'text-color'">{{item.point}}</view>
        </view>
       
    </view>
</template>
<script setup lang="ts">
	import { ref,getCurrentInstance } from 'vue';
	import { onLoad } from '@dcloudio/uni-app';
	import { scoreList } from '@/services/api/mine/index';
	import { useAuthStore } from '@/store/modules/auth';
	const { proxy } = getCurrentInstance();
	const userInfo = ref();
	const authStore = useAuthStore();
const list = ref<any[]>([]);
const curt = ref(0);
const listParams = ref<any>({
    pageNo: 1,
    pageSize: 10,
 
});
const isOpenRefresh = ref(true);
const triggered = ref(false);

	onLoad(async () => {
		await authStore.getUserInfos();
		userInfo.value = authStore.getUserInfo;
		userInfo.value.id = authStore.getUserId;
	    await getList();
	});
	async function getList() {
	  const { data } = await scoreList(listParams.value);
	  data.list.forEach((item: any) => {
	      item.createTime = proxy.$moment(item.createTime).format('YYYY.MM.DD HH:mm:ss');
	  });
	  list.value = list.value.concat(data.list);
	}
	//上拉加载
	function scrolltolower() {
	    listParams.value.pageNo++;
	    getList();
	}
</script>
<style lang="scss" scoped>
.integral {
    background: #f5f5f5;
    min-height: 100vh;
    .top-bg {
        background: #fae6be;
    }
    .list {
        background: #fff;
    }
}
</style>
